﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GE;
using GE.Font;
using GE.Objects;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Media;

namespace GE
{
    public class MainMenuScreen : GameScreen
    {
        
        #region Update and Draw
        Song song;
        public MainMenuScreen()
        {
        }

        public override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = new ContentManager(ScreenManager.Game.Services, "Content");

            song = content.Load<Song>("BGM/Castle-Awkwarding");
            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;
        }

        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                       bool coveredByOtherScreen)
        {
        }

        public override void HandleInput(InputState input)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                MediaPlayer.Stop();
                this.ExitScreen();
                ScreenManager.AddScreen(new longroScreen(), PlayerIndex.One);
            }
        }

        public override void Draw(GameTime gameTime)
        {
            
            // Our player and enemy are both actually just text strings.
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend);

            FreetypeFont.DrawString(spriteBatch, "마왕의 성", 
                new Vector2(150, 200), -0.03f, 64, Color.CadetBlue);
            FreetypeFont.DrawString(spriteBatch, "본격 용사를 키워서 잡아먹는 텍스트 라인 디펜스 게임",
                new Vector2(150, 240), -0.03f, 16, Color.White);
            FreetypeFont.DrawString(spriteBatch, "왠지 디자인이 조금 pt같기는 하지만 뭐, 상관 없어!",
                new Vector2(200, 260), -0.03f, 12, Color.White);
            FreetypeFont.DrawString(spriteBatch, "힘들게 글자를 기울이는 기능을 만들어서 보여주고 싶은데, 뭔가 이상하게 만들어져서 안티앨리어싱이 안 들어가기는 하지만 어쨌든 더 상관 없어!",
                new Vector2(100, 280), -0.03f, 8, Color.White);

            FreetypeFont.DrawString(spriteBatch, "프로그래밍: 유지현",
                new Vector2(500, 350), 0.00f, 12, Color.White);
            FreetypeFont.DrawString(spriteBatch, "기획: 박수찬",
                new Vector2(500, 370), 0.00f, 12, Color.White);
            FreetypeFont.DrawString(spriteBatch, "잡일: 정진명",
                new Vector2(500, 390), 0.00f, 12, Color.White);
            FreetypeFont.DrawString(spriteBatch, "Thanks to: Yoshi-TS4, @Jeddal_Yail0",
                new Vector2(500, 410), 0.00f, 12, Color.White);

            FreetypeFont.DrawString(spriteBatch, "계속하려면 space키를 누르세요.",
                new Vector2(300, 500), -0.00f, 12, Color.Red);

            spriteBatch.End();
        }

        #endregion
    }
}
